<?php

namespace app\adminapi\export;

use app\services\order\OrderService;

class FinanceOrderExport extends BaseExport
{
    protected $header = [
        '交易时间', '订单类型', '经销商', '订单号', '订单金额', '订单支付金额', '佣金支出', '经销商结算金额'
    ];

    public function createData(array $where)
    {
        $list = app()->make(OrderService::class)->getFinanceList($where)['list'];

        $data = [];

        foreach ($list as $item) {
            $data[] = [
                $item['trade_time'] ?? '',
                $item['order_type_text'] ?? '',
                $item['distributor_name'] ?? '',
                $item['sn'] ?? '',
                $item['price'] ?? '',
                $item['pay_price'] ?? '',
                $item['commission'] ?? '',
                $item['distributor_price'] ?? ''
            ];
        }
        return $data;
    }
}